package com.sun.hunk.util;

import com.sun.hunk.properties.QueryProperties;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *
 * @author sunil
 */
public class QueryUtil {

    private static final String LIMIT = " LIMIT 10 ;";
    public static String getQuery(String query, String param, Map map) {

        List<String> list = new ArrayList<String>();
        list.add(param.trim());
        for (Object k : map.keySet()) {
            if (k.toString().contains("param")) {
                list.add(((String[])map.get(k))[0].toString());
            }
        }
        String q = QueryProperties.getQuery(query, list.toArray(new String[]{}));
        System.out.println("QUWRY : " + q + LIMIT);
        return q + LIMIT;
    }
}
